package com.yxinsur.imc;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.AsyncConfigurerSupport;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

import java.net.InetAddress;
import java.util.concurrent.Executor;

/**
 * 启动程序
 *
 * @author imc
 */
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
public class AdminApplication extends AsyncConfigurerSupport
{
    public static void main(String[] args)
    {
        // System.setProperty("spring.devtools.restart.enabled", "false");
        ConfigurableApplicationContext application = SpringApplication.run(AdminApplication.class, args);
        System.out.println("\n----------------------------------------------------------\n\t");
        System.out.println("    壹心经代服务平台3.0启动成功 ! \n\t");
        System.out.println("----------------------------------------------------------\n");
    }

    @Override
    public Executor getAsyncExecutor(){
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.setCorePoolSize(2);
        executor.setMaxPoolSize(2);
        executor.setQueueCapacity(500);
        executor.setThreadNamePrefix("GithubLookup-");
        executor.initialize();
        return executor;
    }
}
